package tgc.edu.xzy.controller;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import tgc.edu.xzy.custom.JpgridUtils;
import tgc.edu.xzy.entity.Lessee;
import tgc.edu.xzy.form.LesseeForm;
import tgc.edu.xzy.service.ZhService;

@Controller
@RequestMapping(value="/administrator")
public class SystemController {
	@Autowired
	private ZhService zhService;
	
	@RequestMapping(value="lessee_all")
	public String lessee_all() {
		return "system/lessee_all";
	}
	@RequestMapping(value="list")
	@ResponseBody
	public Object list(LesseeForm form) {
		Pageable pageable = form.buildPageable();
		Page<Lessee> all = zhService.findAll(pageable);
		HashMap<String, Object> result =JpgridUtils.getPageResult(all);
		return result;
	}
	
}
